package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    IFollowService followService;

    /**
     * @Description: 是否关注
     * @Param: * @param id
     * @return: com.hmdp.dto.Result
     * @Author: Feng
     * @Date:2023/03/12 9:31
     */
    @GetMapping("/or/not/{id}")
    public Result followOrNot(@PathVariable("id") Long id) {
        return followService.followOrNot(id);
    }


    /**
     * @Description: 关注与取关
     * @Param: * @param id
     * @param flag
     * @return: com.hmdp.dto.Result
     * @Author: Feng
     * @Date:2023/03/12 9:32
     */
    @PutMapping("/{id}/{flag}")
    public Result follow(@PathVariable("id") Long id, @PathVariable("flag") Boolean flag) {
        return followService.follow(id, flag);
    }

    @GetMapping("/common/{id}")
    public Result followCommon(@PathVariable("id") Long id) {
        return followService.followCommon(id);
    }
}
